export function show(id: string, config = {}, showCallback: () => void): boolean {
  // @ts-ignore
  if (!this.state.modal.hasOwnProperty(id)) {
    // eslint-disable-next-line no-console
    console.error('需要先初始化createModal');
    return false;
  }
  // @ts-ignore
  let modalData = this.state.modal[id];
  modalData = Object.assign(modalData, config);
  modalData.showModal = true;
  if (config.hasOwnProperty('content')) {
    modalData.update = true;
  }

  // @ts-ignore
  this.setState(
    {
      // @ts-ignore
      // eslint-disable-next-line react/no-access-state-in-setstate
      modal: this.state.modal,
    },
    () => {
      if (showCallback && typeof showCallback === 'function') showCallback();
    },
  );
  return false;
}

export function close(id: string) {
  // @ts-ignore
  this.state.modal[id].showModal = false;
  // @ts-ignore
  this.setState({
    // @ts-ignore
    // eslint-disable-next-line react/no-access-state-in-setstate
    modal: {},
  });
}
